<script setup lang='ts'>
	import { statusBarHeight, getTitleBarHeight, fillHeight, getLeftIcon } from '@/utils/system';
	// console.log(tt.getCustomButtonBoundingClientRect());
	defineProps({
		title: {
			type: String,
			default: '壁纸'
		}
	})
	
	function search() {
		uni.navigateTo({
			url: '/pages/search/search'
		})
	}
</script>


<template>
	<view class="nav-bar">
		<view class="staus-bar" :style="{height: statusBarHeight + 'px'}"></view>
		<view class="title-bar" :style="{height: getTitleBarHeight() + 'px', marginLeft: getLeftIcon() + 'px'}">
			<view class="title" >{{title}}</view>
			<view class="search" @click="search">
				<uni-icons class="icon" type="search" color="#888" size="18"></uni-icons>
				<text class="text">搜索</text>
			</view>
		</view>
	</view>
	<view class="fill" :style="{height: fillHeight() + 'px'}">
		
	</view>
</template>


<style scoped lang='scss'>
	.nav-bar{
		position: fixed;
		left: 0;
		right: 0;
		z-index: 9;
		background:
		linear-gradient(to bottom, rgba(0, 0, 0, 0), #fff 400rpx), 
		linear-gradient(to right, #beecd8 20%, #f4e2d8);
		.staus-bar{
			
		}
		.title-bar{
			display: flex;
			align-items: center;
			padding: 0 30rpx;
			.title{
				font-size: 44rpx;
				font-weight: bold;
				color: $text-font-color-1;
			}
			.search{
				display: flex;
				align-items: center;
				width: 220rpx;
				height: 56rpx;
				border-radius: 60rpx;
				background-color: rgba(255, 255, 255, .4);
				border: 1rpx solid #fff;
				margin-left: 30rpx;
				color: #999;
				font-size: 28rpx;
				.icon{
					margin-left: 10rpx;
				}
				.text{
					padding-left: 10rpx;
				}
			}
		}
	}
</style>